import abt 
import os
import sstd
columns=os.get_terminal_size().columns
#os.system("clear")
with open("motd","r") as f:
    print(f.read())
#<<<<<<< HEAD
alias=r"""
 ______________________
< AlsakaCraft Launcher >
 ---------------------- 
        \   ^__^
         \  (oo)\_______ 
            (__)\       )\/\ 
                ||----w |
                ||     ||
"""
print(alias)
#=======
#>>>>>>> b66959bcf55931104524b43f42f5fcad9c852dc8
print("欢迎使用AlsakaCraft Launcher！")
#input("按下Enter键来继续,或者按下Ctrl+C或Command+C来退出程序:")
print("按下任意键继续，否则请按下Q退出程序。")
isCon=sstd.Getch()
if isCon=="q":
    exit()
if isCon=="Q":
	exit()
#os.system("clear")
for x in range(len(alias.split("\n"))+1):
	print("\033[A\r",end='')
	sstd.clear()
#load menu
import menu
menu,ml=menu.menu.loadMenu()
#print(type(ml))
print(' '+(ml)*'-'+' ')
for item in menu:
	print('|'+item['text']+(ml-len(item['text']))*" "+"|")
print(' '+(ml)*'-'+' ')
while True:
	cmd='NO'
	option=input('请选择一个选项：')
	for item in menu:
		if option==item['id']:
			cmd=item['cmd']
	if cmd=='NO':
		print("==>输入的值无效。\033[A\r",end='')
		sstd.clear()
	else:
		exec(cmd)
